<!DOCTYPE html>
<html>

<head>
    <title>Example</title>
    <style type="text/css">
    /* 被选中的元素后的紧跟的span元素 */
        :checked+span {
            background-color: red;
            color: white;
            padding: 5px;
            border: medium solid black;
        }
    </style>
</head>

<body>
    <form action="" method="POST">
        <p>
            <label for="apples">Do you like apples:</label>
            <input type="checkbox" id="apples" name="apples">
            <span>This will go red when checked</span>
        </p>
        <input type="submit" value="Submit">
    </form>
</body>

</html>